package core

import (
	"flag"
	"fmt"
	"log"
	"os"
)

func SetLogger() {
	log_filename := GetRunPath() + "/app.log"
	logF := flag.String("log", log_filename, "Log file name")
	flag.Parse()
	outfile, err := os.OpenFile(*logF, os.O_CREATE|os.O_RDWR|os.O_APPEND, 0666)
	if err != nil {
		fmt.Println(*outfile, "open failed")
		os.Exit(1)
	}
	log.SetOutput(outfile)
}
